package com.huaxin.hxcloud.activity;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.huaxin.common.Entity.HxFacilityTaskDetailBean;
import com.huaxin.hxcloud.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by songxf on 2017/9/6.
 * 设备巡检Adapter
 */

class HxDeviceTaskDetailAdater extends BaseQuickAdapter<HxFacilityTaskDetailBean.DataBean.DeviceJaListBean,HxDeviceTaskDetailAdater.ViewHolder> {


    private       Context                                                  mContext;
    private int mIsFinish;

    public HxDeviceTaskDetailAdater(Context context,int inFinish, List<HxFacilityTaskDetailBean.DataBean.DeviceJaListBean> data) {
        super(R.layout.item_device_task_detail, data);
        this.mContext=context;
        this.mIsFinish=inFinish;
    }


    @Override
    protected void convert(ViewHolder holder, HxFacilityTaskDetailBean.DataBean.DeviceJaListBean deviceJaListBean) {
        holder.mTvDeviceName.setText(("设备名称：" + deviceJaListBean.getDeviceName()));
        holder.mDeviceRecyclerview.setHasFixedSize(true);
        holder.mDeviceRecyclerview.setLayoutManager(new LinearLayoutManager(mContext));
        HxDeviceJunJianTaskDetailAdater jianTaskDetailAdater = new HxDeviceJunJianTaskDetailAdater(mContext,mIsFinish,deviceJaListBean.getDeviceItem());
        holder.mDeviceRecyclerview.setAdapter(jianTaskDetailAdater);
        jianTaskDetailAdater.setNewData(deviceJaListBean.getDeviceItem());
    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.tv_device_name)
        TextView     mTvDeviceName;
        @BindView(R.id.device_recyclerview)
        RecyclerView mDeviceRecyclerview;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }



}
